import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
    {
        path: '/login',
        name: 'Login',
        component: () => import(/* webpackChunkName: "Login" */ '@/views/Login.vue'),
    },
    {
        path: '/',
        name: 'Home',
        // route level code-splitting
        // this generates a separate chunk (about.[hash].js) for this route
        // which is lazy-loaded when the route is visited.
        component: () => import(/* webpackChunkName: "about" */ '@/views/Home.vue'),
        children:[
            {
                path:'/article',
                name:'Article',
                component:() => import(/* webpackChunkName: "Article" */ '@/components/article.vue')
            },
            {
                path:'/list',
                name:'List',
                component:() => import(/* webpackChunkName: "List" */ '@/components/typeList.vue')
            },
            {
                path:'/photo',
                name:'Photo',
                component:() => import(/* webpackChunkName: "Photo" */ '@/views/Photo.vue')
            },
        ]
    },
    {
        path: '/admin',
        name: 'Admin',
        component: () => import(/* webpackChunkName: "Admin" */ '@/views/Admin/Admin.vue'),
        children: [
            {
                path: '/addArticle',
                name: 'AddArticle',
                component: () => import(/* webpackChunkName: "AddArticle" */ '@/views/Admin/AddArticle.vue'), 
            },
            {
                path: '/ruleArt',
                name: 'RuleArt',
                component: () => import(/* webpackChunkName: "RuleArt" */ '@/views/Admin/RuleArt.vue'), 
            },
            {
                path: '/ruleMes',
                name: 'RulMes',
                component: () => import(/* webpackChunkName: "RulMes" */ '@/views/Admin/RulMes.vue'), 
            },
            {
                path:'/updateArt',
                name:'UpdateArt',
                component:() => import(/* webpackChunkName: "UpdateArt" */ '@/views/Admin/UpdateArt.vue')
            },
        ]
    }
]

const router = new VueRouter({
    routes
})

export default router
